package com.aauedu.springboot.mybatis.controller;

import com.aauedu.springboot.mybatis.bean.Monster;
import com.aauedu.springboot.mybatis.service.MonsterService;
import org.springframework.data.relational.core.sql.In;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class MonsterController {

    //装配MonsterService
    @Resource
    private MonsterService monsterService;

    @ResponseBody
    @GetMapping("/monster")
    public Monster getMonsterById(@RequestParam("id") Integer id) {
        Monster monster = monsterService.getMonsterById(id);
        return monster;
    }

}
